package com.ruoyi.zsyh.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.zsyh.domain.ZsyhPersonOrderMoney;
import com.ruoyi.zsyh.service.IZsyhPersonOrderMoneyService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 扫码单服务费Controller
 * 
 * @author yuexl
 * @date 2024-08-22
 */
@Controller
@RequestMapping("/zsyh/personOrderMoney")
public class ZsyhPersonOrderMoneyController extends BaseController
{
    private String prefix = "zsyh/personOrderMoney";

    @Autowired
    private IZsyhPersonOrderMoneyService zsyhPersonOrderMoneyService;

    @RequiresPermissions("zsyh:personOrderMoney:view")
    @GetMapping()
    public String personOrderMoney()
    {
        return prefix + "/personOrderMoney";
    }

    /**
     * 查询扫码单服务费列表
     */
    @RequiresPermissions("zsyh:personOrderMoney:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(ZsyhPersonOrderMoney zsyhPersonOrderMoney)
    {
        startPage();
        List<ZsyhPersonOrderMoney> list = zsyhPersonOrderMoneyService.selectZsyhPersonOrderMoneyList(zsyhPersonOrderMoney);
        return getDataTable(list);
    }

    /**
     * 导出扫码单服务费列表
     */
    @RequiresPermissions("zsyh:personOrderMoney:export")
    @Log(title = "扫码单服务费", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(ZsyhPersonOrderMoney zsyhPersonOrderMoney)
    {
        List<ZsyhPersonOrderMoney> list = zsyhPersonOrderMoneyService.selectZsyhPersonOrderMoneyList(zsyhPersonOrderMoney);
        ExcelUtil<ZsyhPersonOrderMoney> util = new ExcelUtil<ZsyhPersonOrderMoney>(ZsyhPersonOrderMoney.class);
        return util.exportExcel(list, "扫码单服务费数据");
    }

    /**
     * 新增扫码单服务费
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存扫码单服务费
     */
    @RequiresPermissions("zsyh:personOrderMoney:add")
    @Log(title = "扫码单服务费", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(ZsyhPersonOrderMoney zsyhPersonOrderMoney)
    {
        return toAjax(zsyhPersonOrderMoneyService.insertZsyhPersonOrderMoney(zsyhPersonOrderMoney));
    }

    /**
     * 修改扫码单服务费
     */
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") String id, ModelMap mmap)
    {
        ZsyhPersonOrderMoney zsyhPersonOrderMoney = zsyhPersonOrderMoneyService.selectZsyhPersonOrderMoneyById(id);
        mmap.put("zsyhPersonOrderMoney", zsyhPersonOrderMoney);
        return prefix + "/edit";
    }

    /**
     * 修改保存扫码单服务费
     */
    @RequiresPermissions("zsyh:personOrderMoney:edit")
    @Log(title = "扫码单服务费", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(ZsyhPersonOrderMoney zsyhPersonOrderMoney)
    {
        return toAjax(zsyhPersonOrderMoneyService.updateZsyhPersonOrderMoney(zsyhPersonOrderMoney));
    }

    /**
     * 删除扫码单服务费
     */
    @RequiresPermissions("zsyh:personOrderMoney:remove")
    @Log(title = "扫码单服务费", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(zsyhPersonOrderMoneyService.deleteZsyhPersonOrderMoneyByIds(ids));
    }
}
